package com.luge.lib_base.ktx

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch

// Io 线程 调度
fun ViewModel.lauchIO(
    exceptionHandler: CoroutineExceptionHandler = CoroutineExceptionHandler{
            CoroutineContext, Throwable ->
        Throwable.printStackTrace()
    },
    block:suspend CoroutineScope.()->Unit

):Job = viewModelScope.launch(Dispatchers.IO+exceptionHandler,block=block)
